import router from './router';
import { closeWebView } from './api/native';
import bus from './utils/event_bus';

router.beforeEach(async (to, from, next) => {
  try {
    bus.$off();
    if (to.meta.checkLogin) {
      next();
    } else {
      next();
    }
  } catch (error) {
    closeWebView();
  }
});
